package org.et.g4.message;

import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;

import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.Session;

import org.springframework.jms.core.MessageCreator;

public class JdbcMonitorMessage implements MessageCreator{

	private HashMap hp;
	public JdbcMonitorMessage(HashMap jdbcMp){hp = jdbcMp;}
	public Message createMessage(Session session) throws JMSException {
		MapMessage mm = session.createMapMessage();
		for(Iterator iterator =hp.entrySet().iterator();iterator.hasNext();)
		{
			Map.Entry elem = (Entry) iterator.next();
			//mm.setString((String)elem.getKey(), (String)elem.getValue());
			mm.setObject((String) elem.getKey(), elem.getValue());
		}
		return mm;
	}

	
}
